<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
        方法重写
        ① 子类中的方法覆盖父类方法
        ② 本质是基于原型的查找（原型链）
      */  
      class Animal {
        eat() {
          console.log("fn eat1");
        }
      }
      class Cat extends Animal {
        eat() {
          console.log("fn eat2");
        }
      }
      const c = new Cat();
      // c->Cat.prototype->Animal.prototype
      c.eat();
    </script>
  </body>
</html>
